var mModule=angular.module("loginModule",[]);

mModule.directive("social",function(){
   return{
       restrict:'E',
       templateUrl:'../admin/app/tpls/social_networks_tpl.html',
       replace:true
   }
});

/**
 * 登陆方法
 */
mModule.controller('dologinctrl',['$scope','$http',function($scope,$http){
	
	$scope.loadDate=function(){
		$http({
			method: 'POST',
			url: '/jshoperxms/adminlogin.action',
			data:{
				"username":$scope.username,
				"password":$scope.password
			}
		}).
    	success(function(data, status, headers, config) {
    		console.log("d="+data);
    		if(data.sucflag){
    			window.location.href="index.html";
    		}else{
    			$scope.msg=data.msg;
    		}
    	}).
    	error(function(data, status, headers, config) {
    		window.location.href="404.html";
    	});
	}
}]);

mModule.directive("submittologin",function(){
	return{
		restrict:'AE',
		link:function(scope,element,attr){
			element.bind("click",function(){
				scope.msg="";
				scope.loadDate();
			});
		}
	}
});